#ifndef VIDEOREAD_H
#define VIDEOREAD_H
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <string>
#include <thread>
#include "thread_safe_queue.h"

class VideoRead {
   public:
    VideoRead(const std::string& videoPath);
    VideoRead();
    ~VideoRead();
    void open(const std::string& videoPath);
    void play();
    void stop();

   public:
    ThreadSafeQueue<cv::Mat> frameQue_;
    int width_;
    int height_;
    int fps_;

   private:
    cv::VideoCapture cap_;
    bool isStop_ = false;
    int stayTime_ = 0;
    std::thread* playTh_ = nullptr;
};

#endif